package org.qsoft.common;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author kk
 *
 */
public class ContextFactory {

	public static ApplicationContext ApplicationContext = null;
	
	public static Object getBean(String name)
	{
		if(ApplicationContext == null)
		{
			ApplicationContext = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml"});
		}
		 
		return ApplicationContext.getBean(name);
	}
	
	public static Object getBean(Class clz)
	{
		return getBean(clz.getName());
	}

}
